home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_gettext.idb / usr / freeware / bin / gettextize.z / gettextize
Encoding:
Text File  |  1999-04-16  |  3.9 KB  |  161 lines

  1. #! /bin/sh
  2. #
  3. # Copyright (C) 1995 Software Foundation, Inc.
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2, or (at your option)
  8. # any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. #
  19.  
  20. # This file is meant for authors or maintainers which want to
  21. # internationalize their package with the help of GNU gettext.  For
  22. # further information how to use it consult the GNU gettext manual.
  23.  
  24. echo=echo
  25. progname=$0
  26. force=0
  27. configstatus=0
  28. origdir=`pwd`
  29. usage="\
  30. Usage: gettextize [OPTION]... [package-dir]
  31.   -h, --help           print this help and exit
  32.   -v, --version        print version information and exit
  33.   -f, --force          force writing of new files even if old exist"
  34. package=gettext
  35. version=0.10
  36.  
  37. while test $# -gt 0; do
  38.   case "$1" in
  39.     -f | --force | --f* )
  40.       shift
  41.       force=1 ;;
  42.     -r | --run | --r* )
  43.       shift
  44.       configstatus=1 ;;
  45.     -h | --help | --h* )
  46.       $echo "$usage"; exit 0 ;;
  47.     --version | --v* )
  48.       echo "$progname - GNU $package $version"; exit 0 ;;
  49.     -- )    # Stop option prcessing
  50.       shift; break ;;
  51.     -* )
  52.       $echo "$usage"; exit 1 ;;
  53.     * )
  54.       break ;;
  55.   esac
  56. done
  57.  
  58. if test $# -gt 1; then
  59.   $echo "$usage"
  60.   exit 1
  61. fi
  62.  
  63. # Fill in the command line options value.
  64. if test $# -eq 1; then
  65.   srcdir=$1
  66.   if cd $srcdir; then
  67.     srcdir=`pwd`
  68.   else
  69.     $echo "Cannot change directory to \`$srcdir'"
  70.     exit 1
  71.   fi
  72. else
  73.   srcdir=$origdir
  74. fi
  75.  
  76. # Directory where the sources are stored.
  77. gettext_dir=/usr/freeware/share/gettext
  78.  
  79. test -f configure.in || {
  80.   $echo "Missing configure.in, please cd to your package first."
  81.   exit 1
  82. }
  83.  
  84. if test -d intl && test $force -eq 0; then
  85.   $echo "\
  86. intl/ subdirectory exists: use option -f if you really want to delete it."
  87.   exit 1
  88. fi
  89.  
  90. if test -f po/Makefile.in.in && test $force -eq 0; then
  91.   $echo "\
  92. po/Makefile.in.in exists: use option -f if you really want to delete it."
  93.   exit 1
  94. fi
  95.  
  96. if test -f NLS && test $force -eq 0; then
  97.   $echo "NLS exists: use option -f if you really want to delete it."
  98.   exit 1
  99. fi
  100.  
  101. $echo "Any pre-existing gettext source file will be removed."
  102. rm -fr intl
  103. mkdir intl || {
  104.   $echo "failed to create intl/ subdirectory"
  105.   exit 1;
  106. }
  107.  
  108. test -d po || mkdir po || {
  109.    $echo "failed to create po/ subdirectory"
  110.    exit 1
  111. }
  112.  
  113. # For simplicity we changed to the gettext source directory.
  114. cd $gettext_dir
  115.  
  116. # Now copy all files.  Take care for the destination directories.
  117. for file in *; do
  118.   case $file in
  119.     intl-*)
  120.       copy=$srcdir/`echo $file | sed 's%^intl-%intl/%'`
  121.       ln -s $gettext_dir/$file $copy 2>/dev/null || cp $file $copy
  122.       ;;
  123.     po-*)
  124.       copy=$srcdir/`echo $file | sed 's%^po-%po/%'`
  125.       rm -f $copy
  126.       ln -s $gettext_dir/$file $copy 2>/dev/null || cp $file $copy
  127.       ;;
  128.     root-*)
  129.       copy=$srcdir/`echo $file | sed 's%^root-%%'`
  130.       rm -f $copy
  131.       ln -s $gettext_dir/$file $copy 2>/dev/null || cp $file $copy
  132.       ;;
  133.     *)
  134.       ;;
  135.   esac
  136. done
  137.  
  138. # Check whether we can run config.status to produce intl/Makefile.in.
  139. cd $origdir
  140. if test -f ./config.status; then
  141.   if test $configstatus -eq 0; then
  142.     echo "Shall I run config.status? (y/n)"
  143.     read ans
  144.     case "$ans" in
  145.       y* | Y* | 1* )
  146.     configstatus=1 ;;
  147.       * )
  148.     ;;
  149.     esac
  150.   fi
  151.  
  152.   test $configstatus -ne 0 &&
  153.     (CONFIG_FILES=intl/Makefile CONFIG_HEADERS= ./config.status)
  154. fi
  155.  
  156. $echo "You should update your own aclocal.m4 by merging into it the contents of"
  157. echo "        $gettext_dir/aclocal.m4"
  158.  
  159. exit 0
  160.  
  161.